package com.github.baichuan.application.scaffold.rest.domain.app;

import com.github.baichuan.application.scaffold.rest.domain.application.Application;
import com.github.baichuan.mapping.EnumDescription;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class App {
    @Id
    private String id;

    @ManyToOne
    @JoinColumn(name = "application_id")
    private Application application;

    private String code;

    private String name;

    @Enumerated(EnumType.STRING)
    private Platform platform;

    @ManyToOne
    @JoinColumn(name = "latest_version_id", unique = true)
    private AppVersion latestVersion;

    public enum Platform {
        @EnumDescription("Android")
        android,

        @EnumDescription("IOS")
        ios,
    }
}
